From 89550dc39da5ccdb7e729c1dc2b68e5075980bd4 Mon Sep 17 00:00:00 2001
From: Pinapelz <yukais@pinapelz.com>
Date: Mon, 30 Jun 2025 23:52:06 -0700
Subject: adjust newsId to map non-ascii characters

vercel limitation
---
 middleware/src/app/[gameName]/page.tsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'middleware/src/app/[gameName]/page.tsx')

diff --git a/middleware/src/app/[gameName]/page.tsx b/middleware/src/app/[gameName]/page.tsx
index 4df7efb..8bf9c0b 100644
--- a/middleware/src/app/[gameName]/page.tsx
+++ b/middleware/src/app/[gameName]/page.tsx
@@ -35,8 +35,8 @@ export async function generateMetadata({
         news.content.split("").reduce((hash: number, char: string) => {
           return (hash << 5) + hash + char.charCodeAt(0);
         }, 5381) >>> 0;
-
-      const newsId = `${news.identifier}-${news.timestamp}-${contentHash.toString(16)}-${news.headline}`;
+      const headlineHash = (news.headline || 'null').split('').reduce((hash: number, char: string) => ((hash << 5) + hash) + char.charCodeAt(0), 5381) >>> 0;
+      const newsId = `${news.identifier}-${news.timestamp}-${contentHash.toString(16)}-${headlineHash.toString(16)}`;
       return newsId === postId;
     });
     if (!matchingPost) {
-- 
cgit v1.2.3

